// 数据库操作
const mongoose = require('mongoose');
// 模型规则类
const {
    Schema
} = mongoose;

// 对象规则验证
const Joi = require('joi');
const bookingSchema = Schema({
    rev_id: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Reservation',
        required: true,
        default: '0354'
    },
    date: {
        type: Date,
        require: true
    },
    // 预订类型：0-全天; 1-半费;
    type: {
        type: Number,
        default: 0,
        enum: [0, 1]
    },
    // 预订状态：0-正常; 1-已到店; 2-已离店; 3-未到店
    state: {
        type: Number,
        default: 0,
        require: true,
        enum: [0, 1, 2, 3]
    },
    // 付费状态：0-未付; 1-已付全费; 2-已付押金; 3-未付
    paid: {
        type: Number,
        default: 0,
        require: true,
        enum: [0, 1, 2, 3]
    }
})